home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_56532.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  37 lines

  1. -- card: 56532 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. Another use of conditional compilation is to avoid reinclusion of header files which are themselves #included into other headers.  (TC provides a simpler method to accomplish this.*)  For a header file named 'filename.h', a common approach is to begin the file with:
  11.  
  12.     # ifndef     filename_h             /* like #ifdef, but means "if not defined" */
  13.     # define    filename_h
  14.  
  15. and end the file with:
  16.  
  17.     # endif
  18.  
  19. Also, note that it is legal to nest #ifdef/#endif conditions.
  20.  
  21. Certain names are defined automatically by the system in use.  For example, the name THINK_C is defined whenever the TC compiler is in use.  The following section demonstrates how to allow TC programs to compile equally under C++.
  22.  
  23. -- part contents for background part 7
  24. ----- text -----
  25. 182
  26.  
  27. -- part contents for background part 29
  28. ----- text -----
  29. 54516
  30.  
  31. -- part contents for background part 27
  32. ----- text -----
  33. TC feature to prevent header reinclusion
  34.  
  35. -- part contents for background part 20
  36. ----- text -----
  37. TC feature to prevent header reinclusion - p177